<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=2,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>意帝商城手机端</title>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<script src="js/zepto.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/touch.js"></script>
<script src="js/index.js" type="text/javascript"></script>
</head>

<body class="pa">
    <div class="main pr">
        <!-- 主体部分 -->
        <div class="content">
            <div class="main1 bg">
                <!-- 头部开始 -->
                <div class="header">
                    <!-- 返回 -->
                    <div class="back">
                        <a href="javascript:history.back(-1)" class="iconfont">&#xe606;</a>
                    </div>

                    <!-- 内页标题 -->
                    <div class="htit">
                        <i>购物车</i>
                    </div>

                    <!-- 顶部分类 -->
                    <div class="hcate">
                        <a href="#" class="iconfont">&#xe604;</a>
                    </div>
                </div>
                <script type="text/javascript">
                    (function($){
                        $.fn.Spinner = function(opts, i){
                            var defaults = {
                                value:1,
                                min:1,
                                len:3
                            }, options = $.extend(defaults, opts), keyCodes = { up : 38, down : 40 };
                            return this.each(function() {
                                var a = $(this).find('.sub');
                                var c = $(this).find('.add');
                                var b = $(this).find('.buy_num');
                                var max = $(this).siblings('.stock').val();
                                var m = $(this).parents('li').children('.market_p').val();
                                var s = $(this).parents('li').children('.sell_p').val();
                                var bm,bs;
                                cv(0);  //值
                                $(this).append(a).append(b).append(c);
                                a.click(function(){
                                    cv(-1);
                                });
                                b.keyup(function(){
                                    cv(0);
                                });
                                c.click(function(){
                                    cv(+1);
                                });
                                b.bind('keyup paste change',function(e){
                                    e.keyCode==keyCodes.up&&cv(+1);
                                    e.keyCode==keyCodes.down&&cv(-1);
                                });

                                function cv(n){
                                    b.val(b.val().replace(/[^\d]/g,''));
                                    bv = parseInt( b.val() || options.min ) + n;
                                    bv >= options.min && bv <= max && b.val( bv );
                                }

                                // 价格计算
                                $('.qxh_cart').on('tap',function(){

                                    var total=0,dis=0,all=0,size=0;

                                    $(".qxh_cart > li").each(function(index, el) {
                                        if($(this).find('.cart_check').is(':checked')){
                                            var num = $(this).find('.buy_num').val();
                                            // 商品总额
                                            total += parseFloat($(this).find('.market_p').val()*num);
                                            // 总计
                                            all += parseFloat($(this).find('.sell_p').val()*num);
                                        }
                                    });

                                    $(".cart_selezx").text($(".cart_check:checked").length);
                                    $(".cart_total").text(total);
                                    $(".cart_dis").text(total - all);
                                    $('.cart_all').html("￥" + all);
                                })
                            });
                        };
                    })(Zepto);
                </script>

                <div class="qxh_show">
                    <!-- 如果为空 -->
                    <div class="cart_empty">
                        <i class="iconfont">&#xe609;</i>
                        购物车还没有任何商品，<a href="#">快去购物吧</a>
                    </div>

                    <!-- 购物车不为空 -->
                    <form action="#" name="myform" method="post" id="goodsCart">
                        <ul class="qxh_cart">
                            <li class="clearfix" id="buycarlist_30_40">
                                <i><input type="checkbox" class="cart_check" name="itempid[]" checked="checked" value="30_40"></i>
                                <a href="#">
                                    <img src="images/pic_06.jpg" alt="意大利之花 起泡葡萄酒 甜型 750ml">
                                </a>
                                <section>
                                    <h3>意大利之花 起泡葡萄酒 甜型 750ml</h3>
                                    <p>价格：<em>￥ 98</em></p>
                                    <p></p>
                                    <div class="clearfix">
                                        <b>数量：</b>
                                        <div class="fl qxh_num buynub">
                                            <button class="sub" type="button">-</button><input type="text" name="pnum30_40" value="1" class="buy_num"><button class="add" type="button">+</button>
                                        </div>
                                        <input type="hidden" class="stock" value="296">
                                        <span class="iconfont"><a href="javascript:void(0);">&#xe608;</a></span>
                                    </div>
                                </section>
                                <input type="hidden" class="market_p" value="120">
                                <input type="hidden" class="sell_p" value="98">
                            </li>
                        </ul>
                        <div class="qxh_totprice clearfix">
                            <section>
                                <p>商品总额：￥<i class="cart_total">120</i>&nbsp;&nbsp;优惠：￥ <i class="cart_dis">22</i></p>
                                <p>共<i class="cart_selezx"></i>件商品&nbsp;&nbsp;&nbsp;总计：<em class="cart_all">￥98</em></p>
                            </section>

                            <input type="button" value="去结算" id="submitCode">
                        </div>
                    </form>
                </div>
                <script type="text/javascript">
                    $(".buynub").Spinner();
                </script>
                <!-- 左下角按钮导航 -->
                <div id="plug-phone" class="plug-phone">
                    <input type="checkbox" id="plug-btn" class="plug-menu" value="" />
                    <div>
                        <a href="#" class="iconfont">&#xe601;</a>
                    </div>
                    <div>
                        <a href="#" class="iconfont">&#xe604;</a>
                    </div>
                    <div>
                        <a href="#" class="iconfont">&#xe603;</a>
                    </div>
                    <div>
                        <a href="#" class="iconfont">&#xe602;</a>
                    </div>
                </div>

                <!-- 底部部分 -->
                <div class="footer">
                    <div class="footer_t">

                        <!-- 未登录 -->
                        <div class="footer_l"><a href="#">登录</a>&nbsp;|&nbsp;<a href="#">注册</a></div>

                        <!-- 已登录 -->
                        <!-- <div class="footer_l"><a href="#">yd-2015415</a>&nbsp;|&nbsp;<a href="#">退出</a></div> -->

                        <div class="footer_r"><a href="#">反馈</a>&nbsp;|&nbsp;<a href="#" class="back_top">回到顶部</a></div>
                    </div>
                    <div class="footer_b">
                        <p>全国免费客服：<i>400-8855-829</i></p>
                        <p>©m.yidi9.com&nbsp;上海意帝酒业有限公司</p>
                    </div>
                </div>
                <!-- 底部结束 -->
            </div>
        </div>
        <!-- 主体部分结束 -->
    </div>
</body>
</html>